package com.gtl.meishi.adapter;

import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.gtl.meishi.bean.CotegroyEntity;

import java.util.List;
//ghgffff
/**
 * Created by zhangke on 16/7/9.
 *  zheshi yige
 */
public class CotegroyAdapter extends PagerAdapter {
    private List<CotegroyEntity> listStrings;
    private Context context;
//hjgj
    public CotegroyAdapter(List<CotegroyEntity> listStrings, Context context) {
        this.listStrings = listStrings;
        this.context = context;
    }

    @Override
    public int getCount() {
        return listStrings.size();
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView((View)object);

    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {

        TextView txt=new TextView(context);
        txt.setText(listStrings.get(position).getName());
        txt.setTextSize(30.f);
        container.addView(txt);
        return txt;
    }
    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view==object;
    }
    @Override
    public CharSequence getPageTitle(int position) {
        return listStrings.get(position).getName();

    }
}
